using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BUS;
using Utility;
using Entities;

public partial class Admin_Themdiadiem : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loaddropdownlist();
        }
    }
    private void loaddropdownlist()
    {
        dr_tenm.DataSource = tbMienBUS .GetAll();
        dr_tenm.DataTextField = tbMiencolumn .tenmien .ToString();
        dr_tenm.DataValueField = tbMiencolumn .mamien .ToString();
        dr_tenm.DataBind();
        dr_tenm.Items.Insert(0, new ListItem("All", "0"));
    }
    protected void btn_them_Click(object sender, EventArgs e)
    {
        try
        {
            tbDiadiem ddiem = new tbDiadiem();
            ddiem.Mamien = int.Parse(dr_tenm.SelectedValue);
            ddiem.Tendiadiem = txt_tendd.Text;

            tbDiadiemBUS.Insert(ddiem);
            Response.Redirect("~/Admin/Danhsachdiadiem.aspx");
        }
        catch
        {
            Response.Redirect("~/Admin/Danhsachdiadiem.aspx");
        }
        
    }
}
